package com.exam.demo.service.business.impl;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.exam.demo.domain.Business;
import com.exam.demo.mapper.BusinessMapper;
import com.exam.demo.service.business.BusinessService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
@RequiredArgsConstructor
public class BusinessServiceImpl implements BusinessService {


    private final BusinessMapper baseMapper;

    @Override
    public List<Business> getList(Business business) {
        return baseMapper.selectList(new QueryWrapper<Business>());
    }

    @Override
    public List<Map<String, Object>> getChart() {
        return baseMapper.selectChart();
    }

    @Override
    public int add(Business business) {
        return baseMapper.insert(business);
    }

    @Override
    public int audit(Business business) {
        return baseMapper.updateById(business);
    }
}
